Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
JQuery/JS "type" in a variable rather than changing the value

I have implemented a barcode scanner which uses mobile cameras to decode and populate a search field . This field has autocomplete function while typing:

For example: database has - 1234, 938, 18279, 3920, 5781

If I type in the search bar "18" it will automatically select 18279 as there are no other options in database

This usually works regularly with barcode scanners (hardware) as they are acting as an input.

However when I use this html5/js based barcode scanner, it is decoding the result and pasting them in the search box however the autocomplete/search function is not working.

This is my code

function onScanSuccess(decodedText, decodedResult) {
    if (decodedText !== lastResult) {
        document.getElementById("search_product").value = ''; 
        beep();
        ++countResults;
        lastResult = decodedText;
        console.log(`Scan result ${decodedText}`, decodedResult);
        document.getElementById("search_product").focus();
        document.getElementById("search_product").value = decodedText;
    }
}

I think the issue is with .value as it is changing the field value rather than "inputting" the result. Are there any alternatives to .value which might solve my issue?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!